package com.extr.security.handler;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.security.core.Authentication;
import org.springframework.security.web.authentication.logout.LogoutSuccessHandler;
import org.springframework.security.web.authentication.logout.SimpleUrlLogoutSuccessHandler;

/**
 *项目：广发网
 *版权：Copyright(c)2013
 *公司：广发证券股份有限公司
 *作者：胡纬
 *创建日期：2015-10-24
 *创建时间：下午4:40:46
 *功能描述：
 */
public class ExtrLogoutSuccessHandler extends SimpleUrlLogoutSuccessHandler implements
        LogoutSuccessHandler {

    @Override  
    public void onLogoutSuccess(HttpServletRequest request, HttpServletResponse response, Authentication authentication)   
      throws IOException, ServletException {
        if("mobile".equals(request.getParameter("j_logouttype"))){
            this.setDefaultTargetUrl("/mobile/login");
        }else{
            this.setDefaultTargetUrl("/home");
        }
        super.onLogoutSuccess(request, response, authentication);  
    }  
}
